package com.xinbochuang.machine.common.enums;

import java.util.Arrays;

/**
 * 机房资源类型
 *
 * @author 黄晓鹏
 * @date 2021-06-25 15:38
 */
public enum MacResType {

    /**
     * 电源
     */
    POWER("power", "电源"),

    /**
     * 消防设施
     */
    FIRE("fire", "消防设施"),

    /**
     * 摄像头
     */
    CAMERA("camera", "摄像头");

    private final String type;
    private final String name;

    MacResType(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public static MacResType getEnum(String type) {
        return Arrays.stream(MacResType.values())
                .filter(macResType -> macResType.getType().toLowerCase().equals(type))
                .findFirst().orElse(null);
    }

}
